package com.joplus.housekeeper.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.joplus.housekeeper.R;
import com.joplus.housekeeper.utils.StringUtils;

import java.util.List;

/**
 * Created by ccm on 2016/12/27 13:12
 */
public class RedRuleAdapter extends BaseAdapter {
    private Context mContext;
    private List<String> list;

    public RedRuleAdapter(Context context, List list) {
        this.mContext = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View inflate = LayoutInflater.from(mContext).inflate(R.layout.item_red_rule, null);
        TextView tv = (TextView) inflate.findViewById(R.id.tv);
        StringUtils.setText(tv,  list.get(position));


        return inflate;
    }
}
